package com.aaa.dao;

import com.aaa.entity.F_Menu;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

public interface F_QuanXianDao {
    @Select("<script>select * from role " +
            " where 1=1  " +
            " <if test=\"name!=null and name!=''\"> and name like concat('%',#{name},'%')</if>"+
            "limit #{start},#{pageSize}</script>")
    List<Map> selectList(Map map);
    @Select("<script>select count(id) from role" +
            " where 1=1 " +
            " <if test=\"name!=null and name!=''\"> and name like concat('%',#{name},'%')</if> </script>")
    Integer getCount(Map map);
    @Update("update role set name=#{name},beizhu=#{beizhu},status=#{status} where id=#{id}")
    int update(Map map);
    @Select("select a.* ,b.mid from menu a   " +
            "JOIN role_menu b on b.mid=a.id where b.rid=#{rid}")
    List<F_Menu> selectListid(Integer rid);
@Delete("delete from role_menu where rid=#{rid}")
    void del(Map map);
 @Insert("insert into role_menu(rid,mid) values(#{rid},#{id})")
    void updaterRole(@Param("id") String id, @Param("rid") Integer rid);
@Insert("insert into role(name,beizhu,status) values(#{name},#{beizhu},#{status})")
    int add(Map map);
    @Select("select a.id id from menu a   " +
            "JOIN role_menu b on b.mid=a.id where b.rid=#{rid}")
    List<Map> selectListid2(Integer rid);
}
